<?php

ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';

use Biz\model\Activity\Page;
use Biz\model\ShopSpecial;

$shopSpecials = ShopSpecial::select("*", [
    'AND' => [
        'status' => [
            ShopSpecial::STATUS_OFFLINE,
            ShopSpecial::STATUS_NORMAL
        ],
        'special_type' => [ShopSpecial::TYPE_SPECIAL_ACTIVITY]
    ],
    'ORDER' => [
        'sort',
        'id'
    ]
]);
foreach ($shopSpecials as $shopSpecial) {
    $pageId = Page::savePageInfo([
        'title' => $shopSpecial['special_title'],
        'bgcolor' => $shopSpecial['special_bgcolor'],
        'cover_img_big' => $shopSpecial['shop_img'],
        'cover_img_small' => $shopSpecial['special_info_img'],
        'share_title' => $shopSpecial['share_title'],
        'share_desc' => $shopSpecial['share_desc'],
        'share_img' => $shopSpecial['share_img'],
        'relation_id' => $shopSpecial['relation_id'],
        'start_time' => $shopSpecial['start_time'],
        'end_time' => $shopSpecial['end_time'],
        'status' => $shopSpecial['status']
    ]);
    exit();
}
